
export default function addRoutesDynamically(router, routes) {
  routes.forEach(route => {
    if(route.children){
      addRoutesDynamically(router, route.children)
    }else{
      let finalroute = {
        ...route
      }
      if(route.component){
        finalroute.component = import(`../views/${route.component}`)
      }
      router.addRoute('layout', finalroute)
    }
  })
}  